﻿package com.PlantVsZombies.Zombies;
import javax.swing.ImageIcon;

import com.PlantVsZombies.common.Zombie;
import com.PlantVsZombies.util.ImageUtil;

public class Zombie_Football extends Zombie{
	public Zombie_Football(int row, int col) {
		super(row, col);
		this.setImage(ImageUtil.FootballZombieWalk);
		this.setLife(15);
		this.setSpeed(3);
	}


	@Override
	public int doRun() {
		if(this.getLife() == 5 && this.hasHead){
			new Thread(new LostHead(this.getRow(), this.getCol())).start();
			this.hasHead = false;
		}
		switch (this.getLife()) {
		case 0:
			this.setImage(ImageUtil.LoadImage(ImageUtil.FootballZombieDie));
			this.setSpeed(0);
			new diedThread().start();
			return 1;
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			if (!this.isAttack())
				this.setImage(ImageUtil.FootballZombieLostHeadWalk);
			else
				this.setImage(ImageUtil.FootballZombieLostHeadAttack);
			break;
		case 6:
		case 7:
		case 8:
		case 9:
			if (!this.isAttack())
				this.setImage(ImageUtil.FootballZombieOrnLostWalk);
			else
				this.setImage(ImageUtil.FootballZombieOrnLostAttack);
			break;
		case 10:
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
			if (!this.isAttack())
				this.setImage(ImageUtil.FootballZombieWalk);
			else
				this.setImage(ImageUtil.FootballZombieAttack);
			break;
		case -10:
			this.setImage(ImageUtil.LoadImage(new ImageIcon(
					"images/image_zombies/Zombie/BoomDie.gif")));
			
			new diedThread().start();
			return 1;
		default:
			break;
		}

		this.move();
		try {
			Thread.sleep(100);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return 1;
	}

}
